<template>
  <smart-page>
    <template #search>
      <smart-search :query-array="APPLY_STREAM" @on-handler="onSearch"/>
    </template>
    <a-table v-model:selectedKeys="selectedKeys"
             :table-layout-fixed="theme.layoutFixed"
             :row-selection="rowSelection"
             :columns="APPLY_COLUMNS"
             :row-key="rowKey"
             :column-resizable="theme.resizable"
             :bordered="theme.bordered"
             :stripe="theme.stripe"
             :sticky-header="theme.sticky"
             :hoverable="theme.hoverAble"
             :pagination="pagination"
             :loading="theme.loading"
             :data="dataSource"
             @page-change="onPageChange"
             @page-size-change="onPageSizeChange">
      <template #tx="{ record }">
        <a-image width=50 height=50 preview=true fit="contain" style="display:flex; align-items:center" alt="qrPay"
                 :src="record.agent.qrPay"/>
      </template>
      <template #action="{ record }">
        <a-space>
          <a-link v-if="record.status.value=='UNDERREVIEW'" @click="editCtr.open(record)"> 审核</a-link>
        </a-space>
      </template>

    </a-table>
    <edit-modal v-if="editCtr.show" :record="editCtr.record" @cancel="editCtr.close"/>
  </smart-page>

</template>
<script lang="ts" setup name="defense-doc-URGENT">
import {onMounted} from 'vue';

import {APPLY_STREAM} from '../resource/search'
import {APPLY_COLUMNS} from "../resource/colums";
import {TablePage} from "@/libs/core";
import {ApplyHttp} from "../resource/http";
import EditModal from './edit.vue'

const pageConfig = {title: '列表', rowKey: 'id', nameKey: 'title'}
const {getApply} = ApplyHttp
const tablePage = new TablePage(pageConfig).setFetchXhr(getApply);

const {theme, pagination, rowKey, dataSource, rowSelection, selectedKeys} = tablePage
const {onFetch, onPageChange, onPageSizeChange, onSearch, editCtr} = tablePage
onMounted(() => onFetch())
</script>

